import java.util.Vector;

/* Todo:
	*max health
	*temporary hitpoints
	*conditions (separate class required)
	*initiative
	*attack
	*intelligent power selection
	*a constructor that takes a level and role and populates accordingly
*/
class Combatant
{
	private String sName;
	private int iAC;
	private int iReflex;
	private int iWill;
	private int iFort;
	private int iHitPoints;
	private int iHealingSurges;
	private Party inParty;
	private Vector<Action> vAtWills;
	private Vector<Action> vEncounters;
	private Vector<Action> vAvailableEncounters;
	private Vector<Action> vDailies;
	private Vector<Action> vAvailableDailies;
	// add at-will, encounter, and daily vectors here
	Combatant(String sMyName, int iMyAC, int iMyReflex, int iMyWill, int iMyFort, int iMyHP)
	{
		sName = sMyName;
		iAC = iMyAC;
		iReflex = iMyReflex;
		iWill = iMyWill;
		iFort = iMyFort;
		iHitPoints = iMyHP;
		iHealingSurges = 6;  // just a decent number
		vAtWills = new Vector<Action>();
		vEncounters = new Vector<Action>();
		vAvailableEncounters = new Vector<Action>();
		vDailies = new Vector<Action>();
		vAvailableDailies = new Vector<Action>();
	}
	public String GetName()
	{
		return sName;
	}
	public int GetAC()
	{
		return iAC;
	}
	public int GetReflex()
	{
		return iReflex;
	}
	public int GetWill()
	{
		return iWill;
	}
	public int GetFort()
	{
		return iFort;
	}
	public void TakeDamage(int iDamage)
	{
		iHitPoints -= iDamage;
		System.out.println(sName +" takes "+ iDamage +" damage. " + iHitPoints +" hitpoints left");
		if (iHitPoints <= 0)
		{
			if(inParty != null) // just in case party hasnt been set
			{
				inParty.RemoveMember(this);
			}
			System.out.println(sName + " is dead.");
		}
	}
	public Party GetParty()
	{
		return inParty;
	}
	public void SetParty(Party myParty)
	{
		inParty = myParty;
	}
	public void SetHealingSurges(int iSurges)
	{
		iHealingSurges = iSurges;
	}
	public void AddAtWill(Action newAction)
	{
		vAtWills.add(newAction);
	}
	public void AddEncounter(Action newAction)
	{
		vEncounters.add(newAction);
		vAvailableEncounters.add(newAction);
	}
	public void AddDaily(Action newAction)
	{
		vDailies.add(newAction);
		vAvailableDailies.add(newAction);
	}
	public void Attack(Combatant Victim)
	{
		// to do this right, we really need a vector of attacks
		if(vAtWills.size() >=1)
		{
			// atm we just use the first at-will
			Action aAttack = vAtWills.elementAt(0);
			System.out.println(GetName() + " swings at " + Victim.GetName());
			aAttack.DoAction(Victim);
		}
	}
}
